require('dotenv').config()
module.exports = {
  mode: 'universal',
  /*
   ** Headers of the page
   */
  head: {
    title: 'NinJa 个人博客',
    meta: [{
        charset: 'utf-8'
      },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1'
      },
      {
        hid: 'description',
        name: 'description',
        content: process.env.npm_package_description || ''
      }
    ],
    link: [{
      rel: 'icon',
      type: 'image/x-icon',
      href: '/favicon.ico'
    }],
    script: [{
      src: 'https://hm.baidu.com/hm.js?61f3439a13e697d14e685837fcc7e0a9'
    }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: {
    color: '#999999',
    height: '2px'
  },
  /*
   ** Global CSS
   */
  css: [
    '@/assets/css/index.scss',
    '@/assets/css/global.scss',
    'video.js/dist/video-js.css',
    '@/assets/css/iconfont.css'
  ],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    '@/plugins/element-ui',
    '@/plugins/date-format',
    {
      src: '@/plugins/vue-markdown',
      ssr: false
    },
    {
      src: '@/plugins/video.js',
      ssr: false
    },
    {
      src: '@/plugins/baidu.js',
      ssr: false
    },
    {
      src: '@/plugins/iconfont.js',
      ssr: false
    }

  ],

  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [],
  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    // Doc: https://github.com/nuxt-community/dotenv-module
    '@nuxtjs/dotenv',
  ],
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {},
  /*
   ** Build configuration
   */
  build: {
    transpile: [/^element-ui/],
    /*
     ** You can extend webpack config here
     */
    optimization: {
      splitChunks: {
        minSize: 10000,
        maxSize: 250000,
      }
    },
    // maxChunkSize: 300000, //maxChunkSize分割文件大小
    productionSourceMap: false, //不产生map文件
    productionGzip: true, //开启gzip压缩
    // productionGzipExtensions: ['js', 'css', 'svg'], //需要压缩的文件类型
    // analyze: true,
    babel: { // 按需加载
      plugins: [
        [
          'component',
          {
            'libraryName': 'element-ui',
            'styleLibraryName': 'theme-chalk'
          }
        ]
      ]
    },
    extend(config, ctx) {}
  }
}
